package com.axjy.util;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

import com.axjy.pojo.Manager;

public class AuthInterceptor extends HandlerInterceptorAdapter{
	@Override
	public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
			throws Exception {
		HttpSession session=request.getSession();
		Manager manager=(Manager) session.getAttribute("manager");
		if(manager==null) {
			response.sendRedirect(request.getContextPath()+"/login");
			return false;
		}
		return true;
	}
}
